import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), q = in.nextInt();
        int[] k = new int[q + 1];
        // a[i] 表示第i个人前面有多少个空位
        int[] a = new int[n + 1];
        for (int i = 1; i <= q; i++) {
            k[i] = in.nextInt();
            int count = k[i];
            // i + 1 ~ i + k 个人往前走
            for (int j = i; j <= i + k[i]; j++) {
                count += a[j];
                if (a[j] > 0) {
                    a[j]--;
                }
            }
            for (int j = i + k[i] + 1; j <= n; j++) {
                a[j] += 1;
            }
            System.out.print(count + " ");
        }
    }
}